module AST where

import Prelude

import Data.List (List)
import Data.Map (Map)

data Instr
  = Move Int
  | Update (Map Int Oper)
  | Loop { idx :: Int, proc :: Proc }
  | In Int
  | Out Int

derive instance Eq Instr

data Oper = Add Int | Set Expr

derive instance Eq Oper

data Expr
  = ECst Int
  | EDyn Int
  | ENeg Expr
  | EAdd Expr Expr
  | ESub Expr Expr
  | EMul Expr Expr

derive instance Eq Expr

type Proc = List Instr
